
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.10.2)

# Declares and names the project.

project("libdvbpsi")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tables/)

set(SOURCE descriptors/dr_02.c
        descriptors/dr_03.c
        descriptors/dr_04.c
        descriptors/dr_05.c
        descriptors/dr_06.c
        descriptors/dr_07.c
        descriptors/dr_08.c
        descriptors/dr_09.c
        descriptors/dr_0a.c
        descriptors/dr_0b.c
        descriptors/dr_0c.c
        descriptors/dr_0d.c
        descriptors/dr_0e.c
        descriptors/dr_0f.c
        descriptors/dr_10.c
        descriptors/dr_11.c
        descriptors/dr_12.c
        descriptors/dr_13.c
        descriptors/dr_14.c
        descriptors/dr_1b.c
        descriptors/dr_1c.c
        descriptors/dr_40.c
        descriptors/dr_41.c
        descriptors/dr_42.c
        descriptors/dr_43.c
        descriptors/dr_44.c
        descriptors/dr_45.c
        descriptors/dr_47.c
        descriptors/dr_48.c
        descriptors/dr_49.c
        descriptors/dr_4a.c
        descriptors/dr_4b.c
        descriptors/dr_4c.c
        descriptors/dr_4d.c
        descriptors/dr_4e.c
        descriptors/dr_4f.c
        descriptors/dr_50.c
        descriptors/dr_52.c
        descriptors/dr_53.c
        descriptors/dr_54.c
        descriptors/dr_55.c
        descriptors/dr_56.c
        descriptors/dr_58.c
        descriptors/dr_59.c
        descriptors/dr_5a.c
        descriptors/dr_62.c
        descriptors/dr_66.c
        descriptors/dr_69.c
        descriptors/dr_73.c
        descriptors/dr_76.c
        descriptors/dr_7c.c
        descriptors/dr_81.c
        descriptors/dr_83.c
        descriptors/dr_86.c
        descriptors/dr_8a.c
        descriptors/dr_a0.c
        descriptors/dr_a1.c
        tables/pat.c tables/pat_private.h
        tables/pmt.c tables/pmt_private.h
        tables/sdt.c tables/sdt_private.h
        tables/eit.c tables/eit_private.h
        tables/cat.c tables/cat_private.h
        tables/nit.c tables/nit_private.h
        tables/tot.c tables/tot_private.h
        tables/sis.c tables/sis_private.h
        tables/bat.c tables/bat_private.h
        tables/rst.c tables/rst_private.h
        tables/atsc_vct.c tables/atsc_vct.h
        tables/atsc_stt.c tables/atsc_stt.h
        tables/atsc_eit.c tables/atsc_eit.h
        tables/atsc_ett.c tables/atsc_ett.h
        tables/atsc_mgt.c tables/atsc_mgt.h
        dvbpsi.c dvbpsi_private.h
        psi.c
        demux.c
        descriptor.c
        decode_mpeg.c)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
        libdvbpsi

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        native-lib.cpp ${SOURCE})

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
        libdvbpsi

        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})
